//********************************************************************************************************************//
//ORGANIZATION:
//AUTHOR: bpeng(bogers.peng@gmail.com)
//SUMMARY:
//********************************************************************************************************************//
#ifndef NATIVE_SYSTEM_BASE_CAUGHTEXCEPTION_H
#define NATIVE_SYSTEM_BASE_CAUGHTEXCEPTION_H

#ifndef NATIVE_SYSTEM_BASE_EXCEPTION_H
#include "System/Base/Exception.h"
#endif

namespace Native { namespace System
{
    //************************************************************************************************************//
    //CCaughtException
    //
    //************************************************************************************************************//
    NATIVE_DECLARE_CONST_OBJECT(CCaughtException, C_CAUGHT_EXCEPTION);
    class NATIVE_LIBRARY_EXPORT CCaughtException :
        public CException
    {
        NATIVE_DECLARE_OBJECT;

    protected:
        CCaughtException();
    public:
        CCaughtException(
            C_SCENE& scene,
            C_EXCEPTION& cause,
            WSTRING& detail = EMPTY_STRING);
    };

#define NATIVE_THROW_CAUGHT_DETAIL(METHOD, CAUSE, DETAIL) \
    throw CCaughtException(NATIVE_SCENE(METHOD), CAUSE, DETAIL)
#define NATIVE_THROW_CAUGHT(METHOD, CAUSE) NATIVE_THROW_CAUGHT_DETAIL(METHOD, CAUSE, EMPTY_STRING)
}}
#endif